import request from '@/utils/request'

export function getCode(telephone) {
  return request({
    url: '/user/code',
    method: 'get',
	params: {telephone}
  })
}

export function codeLogin(data) {
  return request({
    url: '/user/codeLogin',
    method: 'post',
	data
  })
}

export function passwordLogin(data) {
  return request({
    url: '/user/passwordLogin',
    method: 'post',
	data
  })
}

export function register(data) {
  return request({
    url: '/user/register',
    method: 'post',
	data
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'get'
  })
}

export function getUserInfo() {
  return request({
    url: '/user/me',
    method: 'get'
  })
}

export function getUserClub() {
  return request({
    url: '/user/getUserClub',
    method: 'get'
  })
}

// 修改用户信息
export function alterUserInfo(data) {
  return request({
    url: '/user/alterUserInfo',
    method: 'post',
	data
  })
}

// 修改手机号
export function alterUserPhone(phone) {
  return request({
    url: '/user/alterUserPhone',
    method: 'get',
	params: {phone}
  })
}

// 修改密码
export function alterUserPassword(pwd, npwd) {
  return request({
    url: '/user/alterUserPassword',
    method: 'get',
	params: {pwd, npwd}
  })
}

// 管理员登录
export function managerLogin(data) {
  return request({
    url: '/user/managerLogin',
    method: 'post',
	data
  })
}